package oracle.lime.springboot2x.chapter5.controller;

import oracle.lime.springboot2x.chapter5.pojo.User;
import oracle.lime.springboot2x.chapter5.service.MyBatisUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping(value = "/mybatis")
public class MyBatisUserController {

    @Autowired
    private MyBatisUserService myBatisUserService;

    @GetMapping(value = "/getUser")
    @ResponseBody
    public User jkl(Long id){
        User user = myBatisUserService.getUser(id);
        return user;
    }
}
